﻿using MoneyManagerNET.Model;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Data.Objects.DataClasses;

namespace TestModel
{
    
    
    /// <summary>
    ///This is a test class for TransactionTest and is intended
    ///to contain all TransactionTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TransactionTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Transaction Constructor
        ///</summary>
        [TestMethod()]
        public void TransactionConstructorTest()
        {
            Transaction target = new Transaction();
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        /// <summary>
        ///A test for CreateTransaction
        ///</summary>
        [TestMethod()]
        public void CreateTransactionTest()
        {
            int id = 0; // TODO: Initialize to an appropriate value
            int categoryId = 0; // TODO: Initialize to an appropriate value
            Decimal amount = new Decimal(); // TODO: Initialize to an appropriate value
            DateTime date = new DateTime(); // TODO: Initialize to an appropriate value
            int contragentId = 0; // TODO: Initialize to an appropriate value
            int subCategoryId = 0; // TODO: Initialize to an appropriate value
            string notes = string.Empty; // TODO: Initialize to an appropriate value
            byte status = 0; // TODO: Initialize to an appropriate value
            Transaction expected = null; // TODO: Initialize to an appropriate value
            Transaction actual;
            actual = Transaction.CreateTransaction(id, categoryId, amount, date, contragentId, subCategoryId, notes, status);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Amount
        ///</summary>
        [TestMethod()]
        public void AmountTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            Decimal expected = new Decimal(); // TODO: Initialize to an appropriate value
            Decimal actual;
            target.Amount = expected;
            actual = target.Amount;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Category
        ///</summary>
        [TestMethod()]
        public void CategoryTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            Category expected = null; // TODO: Initialize to an appropriate value
            Category actual;
            target.Category = expected;
            actual = target.Category;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for CategoryId
        ///</summary>
        [TestMethod()]
        public void CategoryIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.CategoryId = expected;
            actual = target.CategoryId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for CategoryReference
        ///</summary>
        [TestMethod()]
        public void CategoryReferenceTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            EntityReference<Category> expected = null; // TODO: Initialize to an appropriate value
            EntityReference<Category> actual;
            target.CategoryReference = expected;
            actual = target.CategoryReference;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Contragent
        ///</summary>
        [TestMethod()]
        public void ContragentTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            Contragent expected = null; // TODO: Initialize to an appropriate value
            Contragent actual;
            target.Contragent = expected;
            actual = target.Contragent;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ContragentId
        ///</summary>
        [TestMethod()]
        public void ContragentIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.ContragentId = expected;
            actual = target.ContragentId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ContragentReference
        ///</summary>
        [TestMethod()]
        public void ContragentReferenceTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            EntityReference<Contragent> expected = null; // TODO: Initialize to an appropriate value
            EntityReference<Contragent> actual;
            target.ContragentReference = expected;
            actual = target.ContragentReference;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Date
        ///</summary>
        [TestMethod()]
        public void DateTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime actual;
            target.Date = expected;
            actual = target.Date;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for FromAccount
        ///</summary>
        [TestMethod()]
        public void FromAccountTest()
        {
            Transaction transaction = new Transaction(); // TODO: Initialize to an appropriate value
            Account account = new Account() {Id=123, Name="test account"}; // TODO: Initialize to an appropriate value
            //Account actual;

            //int depositCount = expected.DepositList.Count;
            transaction.FromAccount = account;

            //actual = target.FromAccount;
            //Assert.AreEqual(expected, actual);

            bool contains=account.WirthdrawList.Contains(transaction);
            Assert.IsTrue(contains, "setting ToAccount doesnt add transaction into account.DepositList");


            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for FromAccountId
        ///</summary>
        [TestMethod()]
        public void FromAccountIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            Nullable<int> expected = new Nullable<int>(); // TODO: Initialize to an appropriate value
            Nullable<int> actual;
            target.FromAccountId = expected;
            actual = target.FromAccountId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for FromAccountReference
        ///</summary>
        [TestMethod()]
        public void FromAccountReferenceTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            EntityReference<Account> expected = null; // TODO: Initialize to an appropriate value
            EntityReference<Account> actual;
            target.FromAccountReference = expected;
            actual = target.FromAccountReference;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Id
        ///</summary>
        [TestMethod()]
        public void IdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.Id = expected;
            actual = target.Id;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Notes
        ///</summary>
        [TestMethod()]
        public void NotesTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            target.Notes = expected;
            actual = target.Notes;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for Status
        ///</summary>
        [TestMethod()]
        public void StatusTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            byte expected = 0; // TODO: Initialize to an appropriate value
            byte actual;
            target.Status = expected;
            actual = target.Status;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for SubCategory
        ///</summary>
        [TestMethod()]
        public void SubCategoryTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            SubCategory expected = null; // TODO: Initialize to an appropriate value
            SubCategory actual;
            target.SubCategory = expected;
            actual = target.SubCategory;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for SubCategoryId
        ///</summary>
        [TestMethod()]
        public void SubCategoryIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            target.SubCategoryId = expected;
            actual = target.SubCategoryId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for SubCategoryReference
        ///</summary>
        [TestMethod()]
        public void SubCategoryReferenceTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            EntityReference<SubCategory> expected = null; // TODO: Initialize to an appropriate value
            EntityReference<SubCategory> actual;
            target.SubCategoryReference = expected;
            actual = target.SubCategoryReference;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ToAccount
        ///</summary>
        [TestMethod()]
        public void ToAccountTest()
        {
            Transaction transaction = new Transaction(); // TODO: Initialize to an appropriate value
            Account account = new Account() { Id = 123, Name = "test account" }; // TODO: Initialize to an appropriate value
            //Account actual;

            //int depositCount = expected.DepositList.Count;
            transaction.ToAccount = account;

            //actual = target.FromAccount;
            //Assert.AreEqual(expected, actual);

            bool contains = account.DepositList.Contains(transaction);
            Assert.IsTrue(contains, "setting ToAccount doesnt add transaction into account.DepositList");


            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ToAccountId
        ///</summary>
        [TestMethod()]
        public void ToAccountIdTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            Nullable<int> expected = new Nullable<int>(); // TODO: Initialize to an appropriate value
            Nullable<int> actual;
            target.ToAccountId = expected;
            actual = target.ToAccountId;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ToAccountReference
        ///</summary>
        [TestMethod()]
        public void ToAccountReferenceTest()
        {
            Transaction target = new Transaction(); // TODO: Initialize to an appropriate value
            EntityReference<Account> expected = null; // TODO: Initialize to an appropriate value
            EntityReference<Account> actual;
            target.ToAccountReference = expected;
            actual = target.ToAccountReference;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
